; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
;; Check the cases involving dso_local_equivalent where we do expect functions to be merged.
; RUN: opt -S -passes=mergefunc < %s | FileCheck %s

; CHECK-NOT: @b

@x = constant { ptr, ptr } { ptr @a, ptr @b }
; CHECK: { ptr @a, ptr @a }

define i32 @func() {
; CHECK-LABEL: @func(
; CHECK-NEXT:    ret i32 0
;
  ret i32 0
}

define internal i32 @a() unnamed_addr {
; CHECK-LABEL: @a(
; CHECK-NEXT:    [[TMP1:%.*]] = call i32 dso_local_equivalent @func()
; CHECK-NEXT:    ret i32 [[TMP1]]
;
  %1 = call i32 dso_local_equivalent @func()
  ret i32 %1
}

define internal i32 @b() unnamed_addr {
  %1 = call i32 dso_local_equivalent @func()
  ret i32 %1
}
